<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>引言 | 引言</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="以Django为代表的python web应用部署时采用wsgi协议与服务器对接（被服务器托管），而这类服务器通常都是基于多线程的，也就是说每一个网络请求服务器都会有一个对应的线程来用web应用（如Django）进行处理。">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="gitbook/style.css">
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="./c01/index.html" />
    
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="0"
        data-chapter-title="引言"
        data-filepath="README.md"
        data-basepath="."
        data-revision="Fri Feb 10 2017 17:36:30 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter active" data-level="0" data-path="index.html">
            
                
                    <a href="./index.html">
                
                        <i class="fa fa-check"></i>
                        
                        引言
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="c01/index.html">
            
                
                    <a href="./c01/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        1 关于Tornado
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="c01/s01.html">
            
                
                    <a href="./c01/s01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        1.1 Tornado是为何物
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="c01/s02.html">
            
                
                    <a href="./c01/s02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        1.2 Tornado与Django
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="c02/index.html">
            
                
                    <a href="./c02/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        2 初识Tornado
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="c02/s01.html">
            
                
                    <a href="./c02/s01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        2.1 安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="c02/s02.html">
            
                
                    <a href="./c02/s02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        2.2 Hello Itcast
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="c02/s03.html">
            
                
                    <a href="./c02/s03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        2.3 httpserver
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="c02/s04.html">
            
                
                    <a href="./c02/s04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        2.4 options
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="c02/s05.html">
            
                
                    <a href="./c02/s05.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        2.5 练习
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="c03/index.html">
            
                
                    <a href="./c03/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        3 深入Tornado
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="c03/s01.html">
            
                
                    <a href="./c03/s01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        3.1 Application
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="c03/s02.html">
            
                
                    <a href="./c03/s02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        3.2 输入
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="c03/s03.html">
            
                
                    <a href="./c03/s03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        3.3 输出
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="c03/s04.html">
            
                
                    <a href="./c03/s04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        3.4 接口与调用顺序
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="c03/s05.html">
            
                
                    <a href="./c03/s05.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        3.5 练习
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="c04/index.html">
            
                
                    <a href="./c04/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        4 模板
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="c04/s01.html">
            
                
                    <a href="./c04/s01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        4.1 静态文件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="c04/s02.html">
            
                
                    <a href="./c04/s02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        4.2 使用模板
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="c04/s03.html">
            
                
                    <a href="./c04/s03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        4.3 练习
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="c05/index.html">
            
                
                    <a href="./c05/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        5 数据库
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="c05/s01.html">
            
                
                    <a href="./c05/s01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        5.1 数据库
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="c05/s02.html">
            
                
                    <a href="./c05/s02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        5.2 练习
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="c06/index.html">
            
                
                    <a href="./c06/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        6 安全应用
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="c06/s01.html">
            
                
                    <a href="./c06/s01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        6.1 Cookie
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="c06/s02.html">
            
                
                    <a href="./c06/s02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        6.2 XSRF
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="c06/s03.html">
            
                
                    <a href="./c06/s03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        6.3 用户验证
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="c06/s04.html">
            
                
                    <a href="./c06/s04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        6.4 练习
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7" data-path="c07/index.html">
            
                
                    <a href="./c07/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        7 异步与WebSocket
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1" data-path="c07/s01.html">
            
                
                    <a href="./c07/s01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.1.</b>
                        
                        7.1 认识异步
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="c07/s02.html">
            
                
                    <a href="./c07/s02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.</b>
                        
                        7.2 Tornado异步
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="c07/s03.html">
            
                
                    <a href="./c07/s03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.3.</b>
                        
                        7.3 WebSocket
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.4" data-path="c07/s04.html">
            
                
                    <a href="./c07/s04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.4.</b>
                        
                        7.4 练习
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8" data-path="c08/index.html">
            
                
                    <a href="./c08/index.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        8 部署
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="8.1" data-path="c08/s01.html">
            
                
                    <a href="./c08/s01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.1.</b>
                        
                        8.1 部署Tornado
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="./" >引言</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x5F15;&#x8A00;">&#x5F15;&#x8A00;</h1>
<h2 id="&#x56DE;&#x60F3;django&#x7684;&#x90E8;&#x7F72;&#x65B9;&#x5F0F;">&#x56DE;&#x60F3;Django&#x7684;&#x90E8;&#x7F72;&#x65B9;&#x5F0F;</h2>
<p>&#x4EE5;Django&#x4E3A;&#x4EE3;&#x8868;&#x7684;python web&#x5E94;&#x7528;&#x90E8;&#x7F72;&#x65F6;&#x91C7;&#x7528;wsgi&#x534F;&#x8BAE;&#x4E0E;&#x670D;&#x52A1;&#x5668;&#x5BF9;&#x63A5;&#xFF08;&#x88AB;&#x670D;&#x52A1;&#x5668;&#x6258;&#x7BA1;&#xFF09;&#xFF0C;&#x800C;&#x8FD9;&#x7C7B;&#x670D;&#x52A1;&#x5668;&#x901A;&#x5E38;&#x90FD;&#x662F;&#x57FA;&#x4E8E;<strong>&#x591A;&#x7EBF;&#x7A0B;</strong>&#x7684;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x8BF4;<strong>&#x6BCF;&#x4E00;&#x4E2A;&#x7F51;&#x7EDC;&#x8BF7;&#x6C42;&#x670D;&#x52A1;&#x5668;&#x90FD;&#x4F1A;&#x6709;&#x4E00;&#x4E2A;&#x5BF9;&#x5E94;&#x7684;&#x7EBF;&#x7A0B;&#x6765;&#x7528;web&#x5E94;&#x7528;&#xFF08;&#x5982;Django&#xFF09;&#x8FDB;&#x884C;&#x5904;&#x7406;</strong>&#x3002;</p>
<h2 id="&#x8003;&#x8651;&#x4E24;&#x7C7B;&#x5E94;&#x7528;&#x573A;&#x666F;">&#x8003;&#x8651;&#x4E24;&#x7C7B;&#x5E94;&#x7528;&#x573A;&#x666F;</h2>
<ol>
<li><p><strong>&#x7528;&#x6237;&#x91CF;&#x5927;&#xFF0C;&#x9AD8;&#x5E76;&#x53D1;</strong></p>
<p> &#x5982;&#x79D2;&#x6740;&#x62A2;&#x8D2D;&#x3001;&#x53CC;&#x5341;&#x4E00;&#x67D0;&#x5B9D;&#x8D2D;&#x7269;&#x3001;&#x6625;&#x8282;&#x62A2;&#x706B;&#x8F66;&#x7968;</p>
</li>
<li><p><strong>&#x5927;&#x91CF;&#x7684;HTTP&#x6301;&#x4E45;&#x8FDE;&#x63A5;</strong></p>
<p> &#x4F7F;&#x7528;&#x540C;&#x4E00;&#x4E2A;TCP&#x8FDE;&#x63A5;&#x6765;&#x53D1;&#x9001;&#x548C;&#x63A5;&#x6536;&#x591A;&#x4E2A;HTTP&#x8BF7;&#x6C42;/&#x5E94;&#x7B54;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x4E3A;&#x6BCF;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x8BF7;&#x6C42;/&#x5E94;&#x7B54;&#x6253;&#x5F00;&#x65B0;&#x7684;&#x8FDE;&#x63A5;&#x7684;&#x65B9;&#x6CD5;&#x3002;</p>
<p> &#x5BF9;&#x4E8E;HTTP 1.0&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x8BF7;&#x6C42;&#x7684;&#x5305;&#x5934;&#xFF08;Header&#xFF09;&#x4E2D;&#x6DFB;&#x52A0;<strong>Connection: Keep-Alive</strong>&#x3002;</p>
<p> &#x5BF9;&#x4E8E;HTTP 1.1&#xFF0C;&#x6240;&#x6709;&#x7684;&#x8FDE;&#x63A5;&#x9ED8;&#x8BA4;&#x90FD;&#x662F;&#x6301;&#x4E45;&#x8FDE;&#x63A5;&#x3002;</p>
</li>
</ol>
<p>&#x5BF9;&#x4E8E;&#x8FD9;&#x4E24;&#x79CD;&#x573A;&#x666F;&#xFF0C;&#x901A;&#x5E38;&#x57FA;&#x4E8E;&#x591A;&#x7EBF;&#x7A0B;&#x7684;&#x670D;&#x52A1;&#x5668;&#x5F88;&#x96BE;&#x5E94;&#x5BF9;&#x3002;</p>
<h2 id="c10k&#x95EE;&#x9898;">C10K&#x95EE;&#x9898;</h2>
<p>&#x5BF9;&#x4E8E;&#x524D;&#x6587;&#x63D0;&#x51FA;&#x7684;&#x8FD9;&#x79CD;&#x9AD8;&#x5E76;&#x53D1;&#x95EE;&#x9898;&#xFF0C;&#x6211;&#x4EEC;&#x901A;&#x5E38;&#x7528;C10K&#x8FD9;&#x4E00;&#x6982;&#x5FF5;&#x6765;&#x63CF;&#x8FF0;&#x3002;C10K&#x2014;&#x2014; <strong>C</strong>oncurrently handling <strong>ten thousand</strong> connections&#xFF0C;&#x5373;&#x5E76;&#x53D1;10000&#x4E2A;&#x8FDE;&#x63A5;&#x3002;&#x5BF9;&#x4E8E;&#x5355;&#x53F0;&#x670D;&#x52A1;&#x5668;&#x800C;&#x8A00;&#xFF0C;&#x6839;&#x672C;&#x65E0;&#x6CD5;&#x627F;&#x62C5;&#xFF0C;&#x800C;&#x91C7;&#x7528;&#x591A;&#x53F0;&#x670D;&#x52A1;&#x5668;&#x5206;&#x5E03;&#x5F0F;&#x53C8;&#x610F;&#x5473;&#x7740;&#x9AD8;&#x6602;&#x7684;&#x6210;&#x672C;&#x3002;&#x5982;&#x4F55;&#x89E3;&#x51B3;C10K&#x95EE;&#x9898;&#xFF1F;</p>
<h2 id="tornado">Tornado</h2>
<p>Tornado&#x5728;&#x8BBE;&#x8BA1;&#x4E4B;&#x521D;&#x5C31;&#x8003;&#x8651;&#x5230;&#x4E86;&#x6027;&#x80FD;&#x56E0;&#x7D20;&#xFF0C;&#x65E8;&#x5728;&#x89E3;&#x51B3;C10K&#x95EE;&#x9898;&#xFF0C;&#x8FD9;&#x6837;&#x7684;&#x8BBE;&#x8BA1;&#x4F7F;&#x5F97;&#x5176;&#x6210;&#x4E3A;&#x4E00;&#x4E2A;&#x62E5;&#x6709;&#x975E;&#x5E38;&#x9AD8;&#x6027;&#x80FD;&#x7684;<strong>&#x89E3;&#x51B3;&#x65B9;&#x6848;</strong>&#xFF08;&#x670D;&#x52A1;&#x5668;&#x4E0E;&#x6846;&#x67B6;&#x7684;&#x96C6;&#x5408;&#x4F53;&#xFF09;&#x3002;</p>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        
        <a href="./c01/index.html" class="navigation navigation-next navigation-unique" aria-label="Next page: 1 关于Tornado"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="gitbook/app.js"></script>

    
    <script src="gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
